package Java学习;

import java.util.*;
import java.util.Map;

public class 集合的嵌套 {
    public static void main(String[] args) {
        Map<String, ArrayList<String>> map = new HashMap<>();
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("郑州市");
        list1.add("南阳市");
        list1.add("信阳市");
        ArrayList<String> list2 = new ArrayList<>();
        list2.add("郑州市");
        list2.add("南阳市");
        list2.add("信阳市");
        map.put("河南省", list1);
        map.put("南阳市", list2);
        Set<Map.Entry<String, ArrayList<String>>> entries = map.entrySet();
        Iterator<Map.Entry<String, ArrayList<String>>> iterator = entries.iterator();
        while (iterator.hasNext()){
            Map.Entry<String, ArrayList<String>> m = iterator.next();
            String str = m.getKey();
            ArrayList<String> arr = m.getValue();
            StringJoiner sj = new StringJoiner(", ", "", "");
            Iterator<String> itea = arr.iterator();
            while (itea.hasNext()){
                String s = itea.next();
                sj.add(s);
            }
            System.out.println(str + ": " + sj);
        }
    }
}
